<div [@routerTransition]>
    <div class="content d-flex flex-column flex-column-fluid">

        <sub-header [title]="'AppVersion' | localize" [description]="'AppVersion' | localize">
            <div role="actions">
                <button *ngIf="!appSession.tenantId" (click)="createItem()" class="btn btn-primary blue">
                    <i class="fa fa-plus"></i> {{l("add")}}{{l('AppVersion')}}</button>
            </div>
        </sub-header>

        <div [class]="containerClass">
            <div class="card card-custom gutter-b">
                <div class="card-body">
                    <div class="row align-items-center">
                        <!--<Primeng-Datatable-Start>-->
                        <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                            <p-table #dataTable (onLazyLoad)="getList($event)" [value]="primengTableHelper.records"
                                [rows]="primengTableHelper.defaultRecordsCountPerPage" [paginator]="false" [lazy]="true"
                                [resizableColumns]="primengTableHelper.resizableColumns"
                                [responsive]="primengTableHelper.isResponsive">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width: 15%">{{l('Actions')}}</th>
                                        <th style="width:5%">{{l('RecordId')}}</th>
                                        <th style="width:15%">{{l('version')}}</th>
                                        <th>{{l('description')}}</th>
                                        <th style="width:15%">{{l('releaseDate')}}</th>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="body" let-record let-i="rowIndex">
                                    <tr [pSelectableRow]="record" [attr.trid]="record.id">
                                        <td>
                                            <div *ngIf="appSession.tenantId" class="btn-group">
                                                <button type="button" class="btn btn-sm btn-primary"
                                                    (click)="goDetail(record)">
                                                    {{l("detail")}}
                                                </button>
                                            </div>
                                            <div *ngIf="!appSession.tenantId" class="btn-group dropdown" dropdown
                                                normalizePosition>
                                                <button class="dropdown-toggle btn btn-sm btn-primary"
                                                    data-toggle="dropdown" dropdownToggle aria-haspopup="true"
                                                    aria-expanded="false">
                                                    <i class="fa fa-cog"></i>
                                                    <span class="caret"></span> {{l("Actions")}}
                                                </button>
                                                <ul class="dropdown-menu" *dropdownMenu>
                                                    <li>
                                                        <a class="icon-bianji dropdown-item"
                                                            (click)="editItem(record)">{{l('Edit')}}</a>
                                                    </li>
                                                    <li>
                                                        <a class="icon-icon-test dropdown-item"
                                                            (click)="deleteItem(record)">{{l('Delete')}}</a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </td>
                                        <td style="width:5%"> {{transIndex(i)}}</td>
                                        <td>
                                            <span>{{record.version}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.description}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.releaseDate|date : "yyyy/MM/dd"}}</span>
                                        </td>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="emptymessage" let-records>
                                    <tr *ngIf="primengTableHelper.records">
                                        <td colspan="4" class="text-center">
                                            <img class="emptymessage"
                                                src="/assets/common/images/placeholder/deviceHolder.png" />
                                        </td>
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                    (onPageChange)="getList($event)"
                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                                </p-paginator>
                                <span class="total-records-count">
                                    {{l('TotalRecordsCount', primengTableHelper.totalRecordsCount)}}
                                </span>
                            </div>
                        </div>
                        <!--<Primeng-Datatable-End>-->
                    </div>
                </div>
            </div>
        </div>

        <appVersionModal #appVersionModal (modalSave)="getList()"></appVersionModal>
    </div>
</div>